Core.Storage.Observable = function() {
	this.nps = {};
};

Core.Storage.Observable.prototype = {

	/**
	 * Sets the listeners, observing the given property, as dirty.
	 * @param String property
	 */
	propertyChanged: function(property) {
		if(this.nps[property]) { this.nps[property].setListenersDirty(); }
	},
	
	/**
	 * Registers listener under property corresponding to the given path.
	 * @param String path - given without any unnecessary leading dots (e.g path instead of .path).
	 * @param Function fn
	 */
	register: function(path, fn) {
		var head = path.pop(".");
		
		if(!this.nps[head]) { this.nps[head] = new Core.Storage.NotifyPoint(); }
		this.nps[head].register(fn);
	},
	
	/**
	 * Unregisters listener from property corresponding to the given path.
	 * @param String path - given without any unnecessary leading dots (e.g path instead of .path).
	 * @param Function fn
	 */
	unregister: function(path, fn) {
		var head = path.pop(".");
		if(this.nps[head]) { this.nps[head].unregister(fn); }
	}
};